import os
import os.path
from PIL import Image


def ResizeImage(filein, fileout, width, height, type):
    img = Image.open(filein)
    out = img.resize((width, height), Image.ANTIALIAS)  # resize image with high-quality
    out.save(fileout, type)


if __name__ == "__main__":
    list = os.listdir('图片')
    for i in range(1, len(list)+1):
        print(i)
        filein = r'图片\{}.jpg'.format(i)
        fileout = r'数据\香水\{}.jpg'.format(i)
        width = 100
        height = 100
        type = 'png'
        ResizeImage(filein, fileout, width, height, type)
